<?php
/*
	商城首页
	获取允许显示在首页的商品
	获取首页设置信息
	
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
if($_RQ['op']=='main'){
	//
	//if(!$setting['issearch']){
		$return['indexpai'][]=array('name'=>'search');
	//}
	//if(!$setting['ishdps']){
		$return['indexpai'][]=array('name'=>'hdps');
	//}
	$return['indexpai'][]=array('name'=>'goods');
	$setting=$this->plugin_setting('page');
	set_html('title',$setting['basic']['title']);
	$return['setting']=$setting['home'];
	//推荐商品
	$parameter=array(
		'params'=>array('pluginname'=>'jy_friends_shop','uniacid'=>$_SESSION['uniacid']),
		'fields'=>array('id','title','image','price','total','active_plugin','active_id','salenum','pluginname'),
		'limit'=>20,
	);
	$list=model('jy_weishop/goods')->goods_list($parameter);
	$return['indexrecommands']=$list;
	$return['list']=$list;
	//公告
	$notice_list = pdo_fetchall('SELECT * FROM ' . tablename('jy_weishop_notice') . ' WHERE uniacid=:uniacid AND status=1  ORDER BY id DESC limit 4', array(':uniacid' => $_SESSION['uniacid']));
	if($notice_list){
		foreach($notice_list as &$notice){
			$notice['createtime']=date('Y-m-d h:i',$notice['createtime']);
		}
	}
	$return['notices']=$notice_list;
	exi($return);
}